{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "d39ca488",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "# 根据题意，应该是随机生成六个二维数组\n",
    "class1 = np.random.randint(0,101,size = (50,3))\n",
    "class2 = np.random.randint(0,101,size = (50,3))\n",
    "class3 = np.random.randint(0,101,size = (50,3))\n",
    "class4 = np.random.randint(0,101,size = (50,3))\n",
    "class5 = np.random.randint(0,101,size = (50,3))\n",
    "class6 = np.random.randint(0,101,size = (50,3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "83273b3a",
   "metadata": {},
   "outputs": [],
   "source": [
    "score = np.concatenate([class1,class2,class3,class4,class5,class6])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "27cedaba",
   "metadata": {},
   "outputs": [],
   "source": [
    "sex = np.random.randint(0,2,size=(300,1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "707728a0",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = np.concatenate([sex,data_score_union],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "9b19a7ce",
   "metadata": {},
   "outputs": [],
   "source": [
    "sex_boy = data[:,0] == 1\n",
    "sex_girl = data[:,0] == 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "f5aaae93",
   "metadata": {},
   "outputs": [],
   "source": [
    "boy_score = data[sex_boy,:]\n",
    "girl_score = data[sex_girl,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "85b3e8c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 0, 0])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([100,  99, 100])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([47.97, 51.57, 48.56])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([44., 49., 50.])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([29.4 , 28.87, 29.18])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "min_boy_score=boy_score.min(axis=0)[1:]\n",
    "max_boy_score=boy_score.max(axis=0)[1:]\n",
    "mean_boy_score=boy_score.mean(axis=0)[1:].round(2)\n",
    "median_boy_score=np.median(boy_score,axis=0)[1:]\n",
    "std_boy_score=boy_score.std(axis=0)[1:].round(2)\n",
    "display(min_boy_score,max_boy_score,mean_boy_score,median_boy_score,std_boy_score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "050d7d6c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 0])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([100, 100, 100])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([50.57, 49.24, 46.9 ])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([50., 49., 46.])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([29.22, 30.64, 29.13])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "min_girl_score=girl_score.min(axis=0)[1:]\n",
    "max_girl_score=girl_score.max(axis=0)[1:]\n",
    "mean_girl_score=girl_score.mean(axis=0)[1:].round(2)\n",
    "median_girl_score=np.median(girl_score,axis=0)[1:]\n",
    "std_girl_score=girl_score.std(axis=0)[1:].round(2)\n",
    "display(min_girl_score,max_girl_score,mean_girl_score,median_girl_score,std_girl_score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fa8b22d4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
